// 门诊收费
<template>
  <el-row class="section-content">
    <el-col :span="24" class="section-option">
      <TopManu @handelNative="handelNative" :TopArr="TopArr" @handelDropdown="handelDropdown" @handelRegistration="()=>{if(activityId !=1)activityId=1,tableData = []}" @handelCharge="activityId = 2" @handelPremium="activityId = 3" @handelSet="()=>{if(activityId != 4) activityId = 4,setData = []}"></TopManu>
    </el-col>
    <el-col :span="24"  class="section-center">
        <el-col :span="6" class="section-Left" v-if="activityId == 1 || activityId == 2">
          <el-col :span="24">
            <div class="outpatient">
              <ViewTitle text="基本信息"/>
              <el-col :span="24">
                <div class="outpatient-message">
                  <el-col :span='9'>
                    <div class="message-img"><img src="static/img/logo.d78cbfc6.png" alt=""></div>
                  </el-col>
                  <el-col :span='14' :offset="1">
                    <div class="message-text">
                      <div class="text-list">
                        <el-col :span='4'>姓名:</el-col>
                        <el-col :span='20'>{{patientInfo.name?patientInfo.name:""}}</el-col>
                      </div>
                      <div class="text-list">
                        <el-col :span='4'>性别</el-col>
                        <el-col :span='20'>{{patientInfo.gender?patientInfo.gender:""}}</el-col>
                      </div>
                      <div class="text-list">
                        <el-col :span='4'>年龄</el-col>
                         <el-col :span='20'>{{patientInfo.age?patientInfo.age:""}}</el-col>
                      </div>
                      <div class="text-list">
                        <el-col :span='8'>出生日期:</el-col>
                        <el-col :span='16'>{{patientInfo.birthday?patientInfo.birthday:""}}</el-col>
                      </div>
                    </div>
                  </el-col>
                </div>
              </el-col>
              <el-col :span="24" style="marginTop:20px;marginBottom:20px;">
                <el-col :span="5">身份证号:</el-col>
                <el-col :span="19">{{patientInfo.id_card}}</el-col>
              </el-col>
              <ViewTitle text="就诊信息"/>
              <el-col :span="23" style="marginTop:20px;">
                <el-timeline >
                <el-timeline-item
                  color="#02bf6b"
                  v-for="(activity, index) in activities"
                  :key="index"
                  >
                <div>
                    <p>{{activity.timestamp}}</p>
                  <el-card>
                    <h4>缴纳挂号费</h4>
                    <p>状态: <span style="color:#02bf6b">已缴清</span>  </p>
                  </el-card>
                </div>
                </el-timeline-item>
              </el-timeline>
              </el-col>
            </div>
          </el-col>
        </el-col>
        <el-col :span="18" style="padding:0 10px;" v-if="activityId == 1 || activityId == 2">
          <el-col :span="24" class='section-right' v-if="activityId == 1">
            <el-col :span="24" >
              <div class="outpatient-from">
                <el-form :inline="true" :model="ruleForm" status-icon label-width="80px" class="demo-ruleForm">
                  <el-form-item label="门诊号" prop="patient_no">
                    <el-input type="text" v-model="ruleForm.patient_no" ></el-input>
                  </el-form-item>
                  <el-form-item label="姓名" prop="name">
                    <el-input type="text" v-model="ruleForm.member_name" ></el-input>
                  </el-form-item >
                  <el-form-item label="性别" prop="gender">
                    <el-select v-model="ruleForm.gender" placeholder="">
                      <el-option label="男" value="1"></el-option>
                      <el-option label="女" value="2"></el-option>
                      <el-option label="未知" value="3"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年龄" prop="age">
                    <el-input @keyup.native="number" type="text"  v-model="ruleForm.age"></el-input>
                  </el-form-item>
                  <el-form-item label="患者类型" prop="member_type">
                    <el-select v-model="ruleForm.member_type" placeholder="">
                      <el-option label="自费" value="1"></el-option>
                      <el-option label="普通门诊" value="2"></el-option>
                      <el-option label="长期门诊" value="3"></el-option>
                      <el-option label="普通住院" value="4"></el-option>
                      <el-option label="离休" value="5"></el-option>
                      <el-option label="城镇居民" value="6"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="身份证号" prop="id_card">
                    <el-input type="text" v-model="ruleForm.id_card"  autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="医疗卡号" prop="treatment_card">
                    <el-input type="text" v-model="ruleForm.treatment_card" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="科室" prop="doctor_dept">
                    <el-input type="password" v-model="ruleForm.doctor_dept" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="大夫" prop="doctor_name">
                    <el-input type="password" v-model="ruleForm.doctor_name" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="挂号类型" prop="register_type">
                    <el-select v-model="ruleForm.register_type" placeholder="">
                      <el-option label="普通号" value="1"></el-option>
                      <el-option label="急诊号" value="2"></el-option>
                      <el-option label="便民号" value="3"></el-option>
                      <el-option label="专家号" value="4"></el-option>
                      <el-option label="免费号" value="5"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;" @click="()=>{tableData = [],getList()}">查询</el-button>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;">新建挂号</el-button>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;">退号</el-button>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;">改号</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-col>

            <el-col :span="24" style="padding:0 20px 20px 20px;">
                <FromList :tableTitle='tableTitle' :highlightCurrentRow="highlightCurrentRow" @handleCurrentChange="handleCurrentChange"  :tableData='tableData' />
            </el-col>
            <viewTitle text="收费明细"/>
            <el-col :span="24" style="padding:20px">
                <FromList :tableTitle='tableTitle' :highlightCurrentRow="highlightCurrentRow" @handleCurrentChange="handleCurrentChange"  :tableData='tableData' />
            </el-col>
          </el-col>
          <el-col :span="24" class='section-right' v-if="activityId == 2">
            <el-col :span="24" >
              <div class="outpatient-from">
                <el-form :inline="true" :model="charge" label-width="auto"  class="demo-ruleForm">
                  <el-form-item label="门诊号">
                    <el-input type="text" v-model="charge.patient_no"></el-input>
                  </el-form-item>
                  <el-form-item label="姓名" >
                    <el-input type="text" v-model="charge.name"></el-input>
                  </el-form-item >
                  <el-form-item label="性别">
                    <el-select v-model="charge.gender" placeholder="">
                      <el-option label="男" value="1"></el-option>
                      <el-option label="女" value="2"></el-option>
                      <el-option label="未知" value="3"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年龄">
                    <el-input type="text" v-model="charge.age"></el-input>
                  </el-form-item>
                  <el-form-item label="来源" >
                    <el-select v-model="charge.member_type" placeholder="">
                      <el-option label="自费" value="1"></el-option>
                      <el-option label="普通门诊" value="2"></el-option>
                      <el-option label="长期门诊" value="3"></el-option>
                      <el-option label="普通住院" value="4"></el-option>
                      <el-option label="离休" value="5"></el-option>
                      <el-option label="城镇居民" value="6"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="处方单号" >
                    <el-input type="text" v-model="charge.number" ></el-input>
                  </el-form-item>
                  <el-form-item label="处方科室">
                    <el-input type="text" v-model="charge.doctor_dept" ></el-input>
                  </el-form-item>
                  <el-form-item label="处方医生">
                    <el-input type="password" v-model="charge.doctor_name"></el-input>
                  </el-form-item>
                  <el-form-item label="划价员" >
                    <el-input type="password" v-model="charge.doctor_name"></el-input>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;" @click="()=>{tableData = [],getList()}">查询</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-col>

          <el-col :span="24" style="padding:0 20px 20px 20px;">
              <FromList @handleCurrentChange="handelToll" :highlightCurrentRow="highlightCurrentRow" :tableTitle='chargeTitle' :tableData='chargeData'/>
          </el-col>
          <el-col :span="24" style="padding:0 20px;">
            <viewTitle text="收费明细"/>
          </el-col>
          <el-col :span="24" style="padding:20px 20px;">
              <FromList   :tableTitle='prescriptionTitle' :tableData='prescriptionData'/>
          </el-col>
          </el-col>
        </el-col>
        <el-col :span="24" class="section-premium" v-if="activityId == 3">
          <el-col :span="20">
            <el-col :span="24" class='premium-left'>
            <el-col :span="24" >
              <div class="outpatient-from">
                <el-form :inline="true" :model="ruleForm" status-icon label-width="80px" class="demo-ruleForm">
                  <el-form-item label="门诊号" prop="patient_no">
                    <el-input type="text" v-model="ruleForm.patient_no" ></el-input>
                  </el-form-item>
                  <el-form-item label="姓名" prop="name">
                    <el-input type="text" v-model="ruleForm.member_name" ></el-input>
                  </el-form-item >
                  <el-form-item label="性别" prop="gender">
                    <el-select v-model="ruleForm.gender" placeholder="">
                      <el-option label="男" value="1"></el-option>
                      <el-option label="女" value="2"></el-option>
                      <el-option label="未知" value="3"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年龄" prop="age">
                    <el-input @keyup.native="number" type="text"  v-model="ruleForm.age"></el-input>
                  </el-form-item>
                  <el-form-item label="患者类型" prop="member_type">
                    <el-select v-model="ruleForm.member_type" placeholder="">
                      <el-option label="自费" value="1"></el-option>
                      <el-option label="普通门诊" value="2"></el-option>
                      <el-option label="长期门诊" value="3"></el-option>
                      <el-option label="普通住院" value="4"></el-option>
                      <el-option label="离休" value="5"></el-option>
                      <el-option label="城镇居民" value="6"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="身份证号" prop="id_card">
                    <el-input type="text" v-model="ruleForm.id_card"  autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="医疗卡号" prop="treatment_card">
                    <el-input type="text" v-model="ruleForm.treatment_card" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="科室" prop="doctor_dept">
                    <el-input type="password" v-model="ruleForm.doctor_dept" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="大夫" prop="doctor_name">
                    <el-input type="password" v-model="ruleForm.doctor_name" autocomplete="off"></el-input>
                  </el-form-item>
                  <el-form-item label="挂号类型" prop="register_type">
                    <el-select v-model="ruleForm.register_type" placeholder="">
                      <el-option label="普通号" value="1"></el-option>
                      <el-option label="急诊号" value="2"></el-option>
                      <el-option label="便民号" value="3"></el-option>
                      <el-option label="专家号" value="4"></el-option>
                      <el-option label="免费号" value="5"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;" @click="()=>{tableData = [],getList()}">查询</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-col>
            <el-col :span="24" style="padding:0 20px 20px 20px;">
              <FromList :tableTitle='tableTitle' :highlightCurrentRow="highlightCurrentRow" @handleCurrentChange="handleCurrentChange"  :tableData='tableData' />
            </el-col>
            <viewTitle text="收费明细"/>
            <el-col :span="24" style="padding:20px">
              <FromList :tableTitle='tableTitle' :highlightCurrentRow="highlightCurrentRow" @handleCurrentChange="handleCurrentChange"  :tableData='tableData' />
            </el-col>
          </el-col>
          <el-col :span="24" class='section-right' v-if="activityId == 2">
            <el-col :span="24" >
              <div class="outpatient-from">
                <el-form :inline="true" :model="charge" label-width="auto"  class="demo-ruleForm">
                  <el-form-item label="门诊号">
                    <el-input type="text" v-model="charge.patient_no"></el-input>
                  </el-form-item>
                  <el-form-item label="姓名" >
                    <el-input type="text" v-model="charge.name"></el-input>
                  </el-form-item >
                  <el-form-item label="性别">
                    <el-select v-model="charge.gender" placeholder="">
                      <el-option label="男" value="1"></el-option>
                      <el-option label="女" value="2"></el-option>
                      <el-option label="未知" value="3"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="年龄">
                    <el-input type="text" v-model="charge.age"></el-input>
                  </el-form-item>
                  <el-form-item label="来源" >
                    <el-select v-model="charge.member_type" placeholder="">
                      <el-option label="自费" value="1"></el-option>
                      <el-option label="普通门诊" value="2"></el-option>
                      <el-option label="长期门诊" value="3"></el-option>
                      <el-option label="普通住院" value="4"></el-option>
                      <el-option label="离休" value="5"></el-option>
                      <el-option label="城镇居民" value="6"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="处方单号" >
                    <el-input type="text" v-model="charge.number" ></el-input>
                  </el-form-item>
                  <el-form-item label="处方科室">
                    <el-input type="text" v-model="charge.doctor_dept" ></el-input>
                  </el-form-item>
                  <el-form-item label="处方医生">
                    <el-input type="password" v-model="charge.doctor_name"></el-input>
                  </el-form-item>
                  <el-form-item label="划价员" >
                    <el-input type="password" v-model="charge.doctor_name"></el-input>
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" style="background:#42b983;" @click="()=>{tableData = [],getList()}">查询</el-button>
                  </el-form-item>
                  
                </el-form>
              </div>
            </el-col>
            <el-col :span="24" style="padding:0 20px;">
                <FromList :tableTitle='chargeTitle' :tableData='chargeData'/>
            </el-col>
          </el-col>
          </el-col>
          <el-col :span="4" class="premium-right">
            <viewTitle text="退费详情"/>
            <el-col :span="24" style="paddingTop:10px;">
              <el-form :inline="true" :model="premiumForm" label-width="auto" class="demo-form-inline">
                <el-form-item label="退费原因">
                  <el-input v-model="premiumForm.user" placeholder="请输入退费原因"></el-input>
                </el-form-item>
                <el-form-item label="说明">
                  <el-input
                    type="textarea"
                    :rows="5"
                    placeholder="请输入内容"
                    v-model="premiumForm.textArea">
                  </el-input>
                </el-form-item>
                <el-col :span="24">
                  退费金额:107.5元
                </el-col>
                <el-col :span="24" style="marginTop:20px;">
                  退费医生:张大富
                </el-col>
                <el-col :span="24" style="marginTop:20px;">
                  退费时间: 2021/06/05 15:00:00
                </el-col>
              </el-form>
            </el-col>
          </el-col>
        </el-col>
        <el-col :span="24" v-if="activityId == 4" style='padding:20px 20px 0 20px;'>
          <el-col :span="24">
            <el-form :inline="true" :model="setFrom" class="demo-form-inline">
              <el-form-item label="科室">
                <el-input v-model="setFrom.dept" placeholder="请输入科室名"></el-input>
              </el-form-item>
              <el-form-item label="职称">
                <el-input v-model="setFrom.positional_title" placeholder="请输入职称"></el-input>
              </el-form-item>
              <el-form-item label="医生姓名">
                <el-input v-model="setFrom.doctor" placeholder="请输入医生姓名"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" style="background:#42b983;" @click="()=>{setData = [],getList()}">查询</el-button>
              </el-form-item>
               <el-form-item>
                <el-button type="primary" style="background:#42b983;" @click="dialogVisible = true">新增</el-button>
              </el-form-item>
            </el-form>
          </el-col>
          <el-col :span="24">
             <FromList :tableTitle='setTitle' @handleEdit="handleEdit" @handleDelete="handleDelete" :tableData='setData'/>
          </el-col>
        </el-col>
        <el-dialog :close-on-click-modal='false'
          title="添加挂号费设置"
          :visible.sync="dialogVisible"
          width="40%"
          >
          <el-col :span="24">
             <el-form :inline="true" :model="addFrom" class="demo-form-inline">
                <el-form-item label="医生选择" prop="head_user">
                  <el-select :remote-method="searchHeadUser" v-model="addFrom.head_user" remote filterable placeholder="请选择">
                  <el-option
                    v-for="item in addList"
                    :key="item.id"
                    :label="item.real_name"
                    :value="item.id">
                  </el-option>
                </el-select>
                </el-form-item>
                <el-form-item label="挂号费">
                  <el-input v-model="addFrom.register_fee" placeholder="请输入职称"></el-input>
                </el-form-item>
                <el-form-item label="诊疗费">
                  <el-input v-model="addFrom.treat_fee" placeholder="请输入医生姓名"></el-input>
                </el-form-item>
                <el-form-item label="备注">
                  <el-input v-model="addFrom.remark" placeholder="备注"></el-input>
                </el-form-item>
              </el-form>
          </el-col>
          <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="dialogVisible = false" style="background:#42b983;">添 加</el-button>
          </span>
        </el-dialog>
        <el-dialog :close-on-click-modal='false'
          :title="dialogVisibleTitle"
          :visible.sync="visibleFlag"
          width="30%"
          :before-close="handleClose"
          >
          <el-col :span="24" style="text-align:center;padding:0 0 20px 0">
            <el-input v-model="premiumInfo.patient_no" placeholder="请输入门诊号" ></el-input>
             <el-col style="marginTop:10px;">
              <pre id="dataBox" style="text-align:left;">  
                 {{json}}
              </pre>
             </el-col>
          </el-col>
          <span slot="footer" class="dialog-footer" >
            <el-button @click="visibleFlag = false,json = ''">取 消</el-button>
            <el-button type="primary" @click="handleBackPsnSlowDisease()">确 定</el-button>
          </span>
        </el-dialog>
        <el-dialog :close-on-click-modal='false'
          title="请上传明细账"
          :visible.sync="visibleFlagUpData"
          width="30%"
          >
          <el-col :span="24" style="text-align:center;padding:0 0 20px 0">
            <input type="file" id="file" />
          </el-col>
          <span slot="footer" class="dialog-footer" >
            <el-button @click="visibleFlagUpData = false">取 消</el-button>
            <el-button type="primary" @click="handleUpData">确 定</el-button>
          </span>
        </el-dialog>
    </el-col>
  </el-row>
</template>

<script>
let that 
import FromList from "@/forComponents/fromList/fromList"
import TopManu from "@/components/TopMenu"
import ViewTitle from "@/forComponents/viewTitle/index.vue"
import {handlePrepareSettlement,handleSettlement,handleBackSettlement,handleVisitInfoUpload,handleFeeDetailUpload,handleBackFeeDetailUpload,handleYbRegister,handleYbBack,handleCheckSettlement,handleCheckDetailSettlement} from "@/api/medical"
import {getList,getFeeIndex,getSetRegistration,getFeeStatus,getFeeDel,getFeeItem,getGetInfo} from "@/api/register"
export default {
   data(){
     return {
        index:0,
        loading:"",
        input:"",
        page:0,
        size:15,
        highlightCurrentRow:true,
        slotValue:"",
        TopArr:[          
        ],
        premiumInfo:{
          number:"",
          patient_no:"",
          register_id:""
        },
        premiumForm:{

        },
        prescriptionTitle:[
         
        ],
        prescriptionData:[
          
        ],
        setFrom:{
          dept:"",
          positional_title:"",
          doctor:""
        },
        addFrom:{
          user_id:"",
          register_fee:"",
          treat_fee:"",
          remark:""
        },
        addList:[],
        dialogVisible:false,
        setTitle:[
          {
            prop:"key",
            name:"序号",
            type:1,
            width:50
          },
          {
            prop:"dept_name",
            name:"科室",
            type:1,
            width:130
          },
          {
            prop:"real_name",
            name:"医生姓名",
            type:1,
            width:120
          },
          {
            prop:"gender",
            name:"医生性别",
            type:1,
            width:100
          },
          {
            prop:"register_fee",
            name:"挂号金额(元)",
            type:1,
            width:120
          },
          {
            prop:"treat_fee",
            name:"诊查金额(元)",
            type:1,
            width:120
          },{
            prop:"key",
            name:"备注",
            type:1
          },{
            prop:"remark",
            name:"创建时间",
            type:1,
            width:100
          },{
            prop:"createName",
            name:"创建人",
            type:1,
            width:100
          },
          {
            prop:"updated_at",
            name:"最后修改时间",
            type:1,
            width:120
          },
          {
            prop:"UpDateName",
            name:"最后修改人",
            type:1,
            width:120
          },
          {
            prop:"operation",
            name:"操作",
            type:4,
            width:120,
            arr:{
              tab1:"启用",
              tab2:"删除"
            }
          },
        ],
        setData:[],
        chargePage:0,
        chargeSize:15,
        activityId:1,
        activities: [
          {
          content: '缴纳挂号费',
          timestamp: '状态:已经缴清',
          } 
        ],
        charge:{
          gender:"",
          patient_no:"",
          name:"",
          age:"",
          id_card:"",
          member_type:"1",
          number:"",
          doctor_name:"",
          doctor_dept:"",
        },
        chargeTitle:[
          {
            prop:"key",
            name:"序号",
            type:1,
            width:50
          },
          {
            prop:"number",
            name:"处方单号",
            type:1,
            width:100
          },
          {
            prop:"trace_id",
            name:"卡号",
            type:1,
            width:260
          },
          {
            prop:"name",
            name:"病人姓名",
            type:1,
            width:100
          },
          {
            prop:"age",
            name:"年龄",
            type:1,
            width:100
          },
          {
            prop:"gender",
            name:"性别",
            type:1,
            width:100
          },
          {
            prop:"birthday",
            name:"出生日期",
            type:1,
            width:100
          },
          {
            prop:"amount",
            name:"应收金额",
            type:1,
            width:100
          },
          {
            prop:"dept_name",
            name:"处方科室",
            type:1,
            width:100
          },{
            prop:"real_name",
            name:"处方医生",
            type:1,
            width:100
          },
          {
            prop:"gender",
            name:"划价员",
            type:1,
            width:100
          },
          {
            prop:"gender",
            name:"划价时间",
            type:1,
            width:100
          },
          {
            prop:"gender",
            name:"来源",
            type:1,
            width:100
          },
          {
            prop:"patient_no",
            name:"门诊号",
            type:1,
            width:100
          },
           {
            prop:"remark",
            name:"处方诊断",
            type:1,
            width:100
          },
        ],
        
        chargeData:[

        ],
        patientInfo:{
          name:"",
          gender:"",
          age:"",
          birthday:"",
          id_card:"",
          doctor_name:"",
          doctor_dept:"",
        },
        ruleForm: {
          patient_no:"",
          name:"",
          gender:"",
          member_type:"0",
          id_card:"",
          treatment_card:"",
          doctor_dept:"",
          doctor_name:"",
          age:"",
          register_type:"0",
        },
        tableTitle:[
          {
              prop:"number",
              name:"序号",
              type:1,
              width:50
          },
          {
              prop:"look_type",
              name:"类型",
              type:1,
          },
          {
              prop:"select",
              name:"状态",
              type:1,
          },
          {
              prop:"name",
              name:"病人姓名",
              type:1,
          },
          {
              prop:"age",
              name:"年龄",
              type:1,
          },
          {
              prop:"gender",
              name:"性别",
              type:1,
          },
          {
              prop:"birthday",
              name:"出生日期",
              type:1,
              width:120
          },
        {
            prop:"patient_no",
            name:"门诊号",
            type:1,
            width:120
        },
        {
            prop:"age",
            name:"患者类型",
            type:1,
        },
        {
            prop:"id_card",
            name:"身份证号",
            type:1,
            width:170
        },
        {
            prop:"age",
            name:"医疗卡号",
            type:1,
        },
        {
            prop:"dept_name",
            name:"科室",
            type:1,
        },
        {
            prop:"real_name",
            name:"大夫",
            type:1,
        },
        {
            prop:"look_type",
            name:"挂号类型",
            type:1,
        },
        {
            prop:"add",
            name:"病种",
            type:1,
        },
        {
            prop:"amount",
            name:"挂号金额",
            type:1,
        },
        {
            prop:"start_time",
            name:"挂号开始时间",
            type:1,
            width:160
        },
        {
            prop:"end_time",
            name:"挂号结束时间",
            type:1,
            width:160
        },
        ],
        highlightCurrentRow:true,
        tableData:[

        ],
        loading:"",
        visibleFlag:false,
        eValue:0,
        dialogVisibleTitle:"",
        json:"",
        visibleFlagUpData:false,
     }
   },
   watch:{
    index(to){
      if(to == 0){
        that.loading.close();
      }else{
      that.loading = that.$loading({
          lock: true,
          text: '',
          background: 'rgba(0, 0, 0, 0.7)'
        });
      }
    },
    activityId(to,q){
      //  if(to == q){
      //    return false
      //  }
       if(to == 1){
         that.getList()
         that.TopArr = [
           {
            type:7,
            name:"挂号"
          },
          {
            type:8,
            name:"挂号撤销"
          },
          {
            type:9,
            name:"人员信息获取"
          }
          
         ]
         
       }else if(to == 2){
         that.TopArr = [
           {
            type:1,
            name:"门诊预结算"
          },
          {
            type:2,
            name:"门诊结算"
          },
          {
            type:3,
            name:"门诊结算撤销"
          },
          {
            type:4,
            name:"上传就诊信息"
          },
          {
            type:5,
            name:"上传费用明细"
          },
          {
            type:6,
            name:"费用明细撤销"
          },{
            type:10,
            name:"医药机构费用结算对总账"
          },
          {
            type:11,
            name:"医药机构费用结算对总明细账"
          }
         ]
       } 
       if(to == 2) that.getArr()
       if(to == 4) that.getSetRegistration()
     }
   },
   mounted(){
    that = this
    that.getList()
    that.getArr()
    that.getSetRegistration()
    that.TopArr = [
      {
      type:7,
      name:"挂号"
      },
      {
        type:8,
        name:"挂号撤销"
      },
      {
        type:9,
        name:"人员信息获取"
      }
    ]
   },
   methods:{
     handleClose(){
        that.visibleFlag = false
        that.json = ''
     },
     handleCheckDetailSettlement(e){
       that.index++
       handleCheckDetailSettlement(e)
       .then(res=>{
         that.index--
         window.open("http://his.boxinyao.com/"+"yibao_file/fe54836ebcf3e8adf3d3c28131101f09.zip")
         that.visibleFlagUpData = false
       })
       .catch(e=>{
          that.index--
          this.$message({
            message:e.message,
            type: 'error'
          });
       })
     },
     handleBackPsnSlowDisease(){
      switch(that.eValue){
        case 1:
         that.handlePrepareSettlement(that.premiumInfo.patient_no)
        break
        case 2:
         that.handleSettlement(that.premiumInfo.patient_no)
        break
        case 3:
         that.handleBackSettlement(that.premiumInfo.patient_no)
        break
        case 4:
         that.handleVisitInfoUpload(that.premiumInfo.patient_no)
        break
        case 5:
         that.handleFeeDetailUpload(that.premiumInfo.patient_no)
        break
        case 6:
         that.handleBackFeeDetailUpload(that.premiumInfo.patient_no)
        break
        case 7:
         that.handleYbRegister(that.premiumInfo.patient_no)
        break
        case 8:
         that.handleYbBack(that.premiumInfo.patient_no)
        break
        case 9:
         that.getGetInfo(that.premiumInfo.patient_no)
        break
        case 10:
         that.handleCheckSettlement(that.premiumInfo.patient_no)
        break
        
      }
      that.premiumInfo.patient_no = ""
     },
     handleUpData(){
       
      //  var formData = new FormData();
       var i = document.getElementById("file")
       var formData = new FormData();
       formData.append('file', i.files[0]);
       if(i.files.length == 0){
          this.$message({
            message:"请选择上传文件",
            type: 'error'
        });
         return false
       }
       that.handleCheckDetailSettlement(formData)
     },
     handelDropdown(e){
      switch(e){
        case 1:
         that.visibleFlag = true
         that.dialogVisibleTitle = "预结算"
        break
        case 2:
         that.visibleFlag = true
         that.dialogVisibleTitle = "结算"
        break
        case 3:
         that.visibleFlag = true
         that.dialogVisibleTitle = "结算撤销"
        break
        case 4:
         that.visibleFlag = true
         that.dialogVisibleTitle = "上传就诊信息"
        break
        case 5:
         that.visibleFlag = true
         that.dialogVisibleTitle = "上传费用明细"
        break
        case 6:
         that.visibleFlag = true
         that.dialogVisibleTitle = "费用明细撤销"
        break
        case 7:
         that.visibleFlag = true
         that.dialogVisibleTitle = "挂号"
        break
        case 8:
         that.visibleFlag = true
         that.dialogVisibleTitle = "挂号撤销"
        break
        case 9:
         that.visibleFlag = true
         that.dialogVisibleTitle = "人员信息获取"
        break
        case 10:
         that.visibleFlag = true
         that.dialogVisibleTitle = "医药机构费用结算对总账"
        break
        case 11: 
         that.visibleFlagUpData = true
         that.dialogVisibleTitle = "医药机构费用结算对总明细账"
        break
      }
      that.eValue = e
     },
     getGetInfo(e){
        that.index++
        getGetInfo({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          
          this.$message({
            message:"获取人员信息成功",
            type: 'success'
          });
         })
         .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
        })
     },
     handleYbBack(e){
        that.index++
        handleYbBack({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          this.$message({
            message:"挂号撤销成功",
            type: 'success'
          });
         })
         .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
        })
     },
     
     handleYbRegister(e){
         that.index++
         handleYbRegister({patient_no:e})
         .then(res=>{
            that.index--
            that.json = res.data
            this.$message({
              message:"挂号成功",
              type: 'success'
            });
         })
         .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
         })
     },
     handleBackFeeDetailUpload(e){
        that.index++
        handleBackFeeDetailUpload({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          this.$message({
            message:"费用明细撤销成功",
            type: 'success'
          });
        })
        .catch(e=>{
          that.index--
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
     handleFeeDetailUpload(e){
        that.index++
         handleFeeDetailUpload({patient_no:e})
         .then(res=>{
            that.index--
            that.json = res.data
            this.$message({
              message:"上传费用明细成功",
              type: 'success'
            });
         })
         .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
         })
     },
     handleVisitInfoUpload(e){
        that.index++
        handleVisitInfoUpload({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          this.$message({
            message:"上传就诊信息成功",
            type: 'success'
          });
        })
        .catch(e=>{
          that.index--
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
      
     handlePrepareSettlement(e){
      that.index++
      handlePrepareSettlement({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          // console.log(res)
          return false
          this.$message({
            message:"预结算成功",
            type: 'success'
          });
        })
        .catch(e=>{
          that.index--
          this.$message({
            message:e.message,
            type: 'error'
        });
      })
     },
     handleSettlement(e){
       that.index++
        handleSettlement({patient_no:e})
         .then(res=>{
            that.index--
            that.json = res.data
            this.$message({
              message:"结算成功",
              type: 'success'
            });
         })
         .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
         })
     },
     handleBackSettlement(e){
        that.index++
        handleBackSettlement({patient_no:e})
        .then(res=>{
          that.index--
          that.json = res.data
          this.$message({
            message:"门诊结算撤销成功",
            type: 'success'
          });
        })
        .catch(e=>{
          that.index--
          this.$message({
            message:e.message,
            type: 'error'
          });
        })
     },
    handleCheckSettlement(e){
        that.index++
        handleCheckSettlement({patient_no:e})
          .then(res=>{
            that.index--
            that.json = res.data
            this.$message({
              message:"门诊结算撤销成功",
              type: 'success'
            });
          })
          .catch(e=>{
            that.index--
            this.$message({
              message:e.message,
              type: 'error'
            });
        })
    },
     handelToll(e){
       that.premiumInfo.number = e.number
       that.premiumInfo.patient_no = e.patient_no
      //  that.getFeeItem()
     },
     getFeeItem(){
      that.index++
      getFeeItem({id:that.premiumInfo.number})
      .then(res=>{
        // console.log(res)
        that.index--
      })
      .catch(e=>{
        that.index--
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
     },
     handelSet(){
      
     },
     searchHeadUser(e){
      that.index++
      getUserList({name:e,page:that.page,limit:that.limit})
      .then(res=>{
        if(res.data.list.length != 0){
          that.arrList = res.data.list
        }
        that.index--
      })
      .catch(e=>{
        that.index--
         this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    getFeeStatus(id,type,key){
      that.index++
      getFeeStatus({id:id,type:type})
      .then(res=>{
        that.index--
        this.$message({
          message:"修改成功",
          type: 'success'
        });
        that.setData[key].status = type
      })
      .catch(e=>{
        that.index--
        // console.log(e)
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    handleEdit(e){
      let type = e.data.status == 1 ? 2 : 1
      that.getFeeStatus(e.data.id,type,e.key)
    },
    handleDelete(e){
      that.index++
      getFeeDel({id:e.data.id})
      .then(res=>{
        that.index--
        that.setData = []
        that.getSetRegistration()
      })
      .catch(e=>{
        that.index--
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    getSetRegistration(){
      that.index++
      getSetRegistration()
      .then(res=>{
        that.index--
        if(res.data.list != 0){
          console.log(res.data.list,"进入")
          res.data.list.map((item,key)=>{
            console.log(item)
            if(item.doctor){
              Object.keys(item.doctor).forEach(key=>{
                if(key == "id"){
                  item.doctorId = item.doctor[key]
                }else{
                  item[key] = item.doctor[key]
                }
              })
            }
            item.gender = item.gender == 1 ? '男' : item.gender == 2 ? '女' : '未知'
            item.createName = item.create_by_user.real_name
            item.createId = item.create_by_user.id
            item.UpDateName = item.update_by_user.real_name
            item.UpDateId = item.update_by_user.id
            item.key = key + 1
            that.setData.push(item)
            return item
          })
        }
        // console.log(that.setdATA)
      })
      .catch(e=>{
          that.index--
          this.$message({
          message:e.message,
          type: 'error'
          });
      })
    },
    getArr(){
      that.index++
      getFeeIndex({page:that.chargePage,limit:that.chargeSize})
      .then(res=>{
        that.index--
        if(res.data.lists.length != 0){
          res.data.lists.forEach((item,key)=>{
            Object.keys(item.member).forEach(key=>{
              if(key != "id"){
                item[key] = item.member[key]
              }else{
                item.user_id = item.member.id
              }
            })
            Object.keys(item.doctor).forEach(key=>{
              if(key != "id"){
                item[key] = item.doctor[key]
              }else{
                item.dept_id = item.doctor.id
              }
            })
            item.gender = item.gender == 1? '男' : item.gender == 2 ? '女' : "未知" 
            item.key = key + 1 
          })
             that.chargeData = res.data.lists
        }
     
      })
      .catch(e=>{
        that.index--
        // console.log(e)
        this.$message({
          message:e.message,
          type: 'error'
        });
      })
    },
    handleCurrentChange(e){
     Object.keys(that.patientInfo).forEach(key=>{
       that.$set(that.patientInfo,key,e[key])
     })
    //  console.log(e)
     that.premiumInfo.register_id = e.id
      // Object.keys(that.charge).forEach(key=>{
      //   console.log(key)
      //   // that.$set(that.charge,key,e[key])
      // })
    },
    getList(){
      that.index++
      getList({page:that.page,limit:that.size,...this.ruleForm})
      .then(res=>{
        that.index--
        console.log(res.data.list.length)
        if(res.data.list.length != 0){
          res.data.list.map((item,key)=>{
            Object.keys(item.member_info).forEach(key=>{
              if(key !== "id"){
                item[key] = item.member_info[key]
              }
            })
            Object.keys(item.doctor_info).forEach(key=>{
              if(key !== "id"){
                item[key] = item.doctor_info[key]
              }
            })
            item.gender = item.gender == 1 ? '男' :item.gender == 2 ? '女' : '未知'
            item.look_type = item.look_type == 1 ? '初诊' :item.look_type == 2 ? '复诊' : ""
            item.number = key
            return item
          })
          that.tableData =  res.data.list
        }
       
      })
      .catch(e=>{
        that.index--
        this.$message({
          message:e.message,
          type: 'error'
        });
      })  
    },
    change(val) {
      // console.log(val)
    },
    handelNative(){
      this.$router.push({path:'/workstation/registration'})
    }
   },
   destroyed(){
     that.index = 0
    //  that.loading.close();
   },
   components:{
     FromList,
     TopManu,
     ViewTitle
   }
}
</script>

<style lang='scss' scoped>
  @import "./index.scss";
  
</style>